<include file="public:header" />
<div class="pad_10">
    <form action="{:u('links/edit')}" method="post" name="myform" id="myform" enctype="multipart/form-data" >
        <table width="100%" cellpadding="2" cellspacing="1" class="table_form">
                <input type="hidden" value="{$links_info.id}" name="id" />
            <tr>
                <th>链接类型 :</th>
                <td><label><input type="radio" name="s_type" onclick="type_tab();" class="radio_style" value="1" <if condition="$links_info.logo eq 0"> checked="checked"</if>>
                                <code>&nbsp;</code>普通链接&nbsp;&nbsp;&nbsp;</label>
                        <label><input type="radio" onclick="type_tab();" name="s_type" class="radio_style" value="0" <if condition="$links_info.logo neq 0"> checked="checked"</if>>
                                <code>&nbsp;</code>图片链接&nbsp;&nbsp;&nbsp; </td></label>
            </tr>
            <tr>
                <th>链接分类 :</th>
                <td><select name="typeid" style="width:140px;">
                        <volist name="type_list" id="val" >
                            <option <if condition="$links_info.typeid eq $val['id']">selected="selected"</if> value="{$val.id}">{$val.type_name}</option>
                        </volist>
                    </select></td>
            </tr>
            <tr>
                <th>所属城市 :</th>
                <td><select name="cityid" style="width:140px;">
                        <volist name="city_list" id="val" >
                            <option <if condition="$links_info.cityid eq $val['id']">selected="selected"</if> value="{$val.id}">{$val.name}</option>
                        </volist>
                    </select></td>
            </tr>
            <tr>
                <th width="60">链接名称 :</th>
                <td><input type="text" name="name" value="{$links_info.name}" id="name" size="30" ></td>
            </tr>
            <tr>
                <th>链接网址 :</th>
                <td><input type="text" name="url" value="{$links_info.url}" id="url" size="30" ></td>
            </tr>
            <tr id="s_img" style="display: none;">
                <th>图片:</th>
                <td><input type="file" name="logo" id="img"/></td>
            </tr>
            <tr>
                <th>排序值 :</th>
                <td><input type="text" name="sort" id="sort_order" class="input-text" size=8 value="1" onkeyup="value=value.replace(/[^\d]/g,'')"onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"></td>
            </tr>
            <tr>
                <th>审核状态 :</th>
                <td><input type="radio" name="status" class="radio_style" value="1" <if condition="$links_info.status eq 1"> checked="checked"</if>>
                    <code>&nbsp;</code>已审核&nbsp;&nbsp;&nbsp;
                    <input type="radio" name="status" class="radio_style" value="0" <if condition="$links_info.status eq 0"> checked="checked"</if>>
                    <code>&nbsp;</code>未审核&nbsp;&nbsp;&nbsp; </td>
            </tr>
        </table>
        <input type="submit" name="dosubmit" id="dosubmit" class="dialog" value="">
    </form>
    <script type="text/javascript">
	$(function(){
		$.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'250',height:'50'}, function(){this.close();$(obj).focus();})}});
		
		$("#name").formValidator({onshow:"不能为空",onfocus:"不能为空"}).inputValidator({min:1,onerror:"请填写链接名称"});
		
		$("#url").formValidator({onshow:"不能为空",onfocus:"http开头"}).inputValidator({min:1,onerror:"请填写链接地址"});
                type_tab();
})
//链接类型切换的时候显示，和隐藏上传图片
        function type_tab(){
                var a;
                a=$(":radio[name=s_type][checked]").val();
                if(a!=1){
                        $("#s_img").css("display","");
                }else{
                        $("#s_img").css("display","none");
                }
        }
</script>
</div>
</body></html>